<?php
if(!defined('INTHEME')){header('Location: ../../index.php'); die();}
//$expires = 60*60*24*14;
$expires = 0;

header("Pragma: public");
header("Cache-control: public");
header("Cache-Control: maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
header('Last-Modified: 1 Sep 2010 15:00:00 GMT');
//header('Content-Type: application/xhtml+xml');
//header('Content-Type: gzip');
header('Content-type: text/html; charset=utf-8');
//пароль
includeLang('theme');

$parse['title'] = $title;
$parse['skinurl'] = 'theme/default';
$skinurl=$parse['skinurl'];

$rUri=explode('/',$_SERVER['REQUEST_URI']);
$rUri=$rUri[count($rUri)-1];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php if ($url != ''){ ?><meta http-equiv="refresh" content="<?php echo $time;?> URL=<?php echo $url;?>" /> <?php } ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="<?php echo getConfig('head', 'MetaD', '');?>" />
<meta name="keywords" content="<?php echo getConfig('head', 'MetaK', '');?>" />
<meta name="Author" content="80MXM08" />
<meta name="Copyright" content="2011 - <?php echo date('Y');?> " />
<meta name="robots" content="all" />
<title><?php echo $title;?></title>
<link rel="SHORTCUT ICON" href="favicon.ico" />
<link rel="stylesheet" href="<?php echo $host;?>/<?php echo $rUri=='login.php'?auto_version($skinurl.'/css/login-min.css'):auto_version($skinurl.'/css/css.css');?>" type="text/css" />
<script type="text/javascript" src="<?php echo $host;?>/<?php echo auto_version($skinurl.'/js/ajax.js');?>"></script>
<script type="text/javascript" language="javascript">
//Config for calendar
var A_TCALCONF = {
	'cssprefix'  : 'tcal',
	'months'     : ['<?php echo $Lang['january'];?>', '<?php echo $Lang['february'];?>', '<?php echo $Lang['march'];?>', '<?php echo $Lang['april'];?>', '<?php echo $Lang['may'];?>', '<?php echo $Lang['june'];?>', '<?php echo $Lang['july'];?>', '<?php echo $Lang['august'];?>', '<?php echo $Lang['september'];?>', '<?php echo $Lang['october'];?>', '<?php echo $Lang['november'];?>', '<?php echo $Lang['december'];?>'],
	'weekdays'   : ['<?php echo $Lang['su'];?>', '<?php echo $Lang['mo'];?>', '<?php echo $Lang['tu'];?>', '<?php echo $Lang['we'];?>', '<?php echo $Lang['th'];?>', '<?php echo $Lang['fr'];?>', '<?php echo $Lang['sa'];?>'],
	'longwdays'  : ['<?php echo $Lang['sunday'];?>', '<?php echo $Lang['monday'];?>', '<?php echo $Lang['tuesday'];?>', '<?php echo $Lang['wednesday'];?>', '<?php echo $Lang['thursday'];?>', '<?php echo $Lang['friday'];?>', '<?php echo $Lang['saturday'];?>'],
	'yearscroll' : true, // show year scroller
	'weekstart'  : 1, // first day of week: 0-Su or 1-Mo
	'prevyear'   : '<?php echo $Lang['previous_year'];?>',
	'nextyear'   : '<?php echo $Lang['next_year'];?>',
	'prevmonth'  : '<?php echo $Lang['previous_month'];?>',
	'nextmonth'  : '<?php echo $Lang['next_month'];?>',
	'format'     : 'd.m.Y' // 'm/d/Y', 'd-m-Y', Y-m-d', 'l, F jS Y'
};
</script>
<script type="text/javascript" src="<?php echo $host;?>/<?php echo auto_version($skinurl.'/js/tcal-packed.js');?>"></script>
<script type="text/javascript" src="<?php echo $host;?>/<?php echo auto_version($skinurl.'/js/pus.js');?>"></script>
</head>
<body>
<?php
if($head)
{
    ?>
    <div id="menu-bar">
    <div id="menu-bar-bar-container">
      <div id="menu-bar-bar">
       <div class="menu-bar-group" style="float: left;"><ul class="menu"><li><button type="button" class="mn_button" onclick="Redirect('<?php echo $host;?>/index.php');"><?php echo $Lang['home'];?></button></li></ul>
<?php
$menu=array();
$menuq=$sql->query("SELECT * FROM menu");
while($menui=$sql->fetch_array($menuq))
{
    array_push($menu, $menui);
}

foreach($menu as $m)
{
    if($m['parent_id']!=null) continue;
    if($user->hasAccess($m['access']))
    {
?>
<ul class ="menu"><li><button type="button" class="mn_button" onclick="Redirect('<?php echo $host;?>/index.php?p=<?php echo $m['link'];?>');"><?php echo $Lang[$m['lang']];?></button>
<?php
    $c=0;
    foreach($menu as $sm)
    {
        if($sm['parent_id']!=$m['id']) continue;
        if($user->hasAccess($sm['access']))
        {
            if($c==0) echo '<ul>';
            $c++;
        ?>
<li><button type="button" class="mn_button" onclick="Redirect('<?php echo $host;?>/index.php?p=<?php echo $sm['link'];?>');"><?php echo $Lang[$sm['lang']];?></button></li>
        <?php
        }
    }
    if($c>0) echo '</ul>';
?>
</li></ul>
<?php 
    }
}
?>
       </div>
       <div class="menu-bar-group" style="float:right; padding-top:3px"><?php echo lang_selector(select_lang(), true);?></div>
       <div class="menu-bar-group" style="float:right; padding-top:3px"><button style="width: 70px; height: 35px;" class="mn_button" type="button" onclick="window.location.href='login.php'"><?php echo $Lang['sign_out'];?></button></div>
</div>
    </div>
</div>
<div align="center" style="text-align: left; float: left;">
<?php } ?>